package main

import (
	"fmt"
	"math/rand"
	"time"
)

type RAND_S struct {
	r       *rand.Rand
	percent *Percent
	base    int
}

type Percent struct {
	first  float32
	second float32
	third  float32
}
type RAND RAND_S

func main() {
	var r RAND
	r.Initial()
	circle := r.ReandCircle(r.base)
	r.Result(circle)
	// fmt.Println(circle)
	fmt.Printf("%v", circle)
}

func (r *RAND) Initial() {
	r.r = rand.New(rand.NewSource(time.Now().Unix()))
	r.percent = &Percent{0.03, 0.06, 0.09}
	r.base = 100
}

func (r *RAND) ReandCircle(n int) []int {
	result := r.r.Perm(n)
	return result
}

func (r *RAND) Result(result []int) {
	first := int((float32)(r.base) * r.percent.first)
	second := int((float32)(r.base) * r.percent.second)
	third := int((float32)(r.base) * r.percent.third)
	fmt.Println(first)
	fmt.Printf("%v\n", result[:first])
	fmt.Println(second)
	fmt.Printf("%v\n", result[first:second+first])
	fmt.Println(third)
	fmt.Printf("%v\n", result[second:third+second+first])
}

func test() {
	r := rand.New(rand.NewSource(time.Now().Unix()))
	fmt.Println(r.Perm(9))
	r.Int63n(3)
}
